import request from '@/utils/request'

// 查询库存调拨列表
export function listTransfer(query) {
  return request({
    url: '/transfer/transfer/list',
    method: 'get',
    params: query
  })
}

// 查询库存调拨详细
export function getTransfer(inventoryTransferId) {
  return request({
    url: '/transfer/transfer/' + inventoryTransferId,
    method: 'get'
  })
}

// 新增库存调拨
export function addTransfer(data) {
  return request({
    url: '/transfer/transfer',
    method: 'post',
    data: data
  })
}
// 仓库库位查询
export function selectAllBsWhLocation(warehouseId) {
  return request({
    url: '/transfer/transfer/selectAllBsWhLocation', // 修正 URL
    method: 'get',
    params: { warehouseId: warehouseId }, // 将仓库 ID 作为查询参数传递
  });
}

// 根据库位编号商品编号查询库存
export function selectWhInventoryByCode(query) {
  return request({
    url: '/transfer/transfer/selectWhInventoryByCode',
    method: 'get',
    params: query
  })
}

// 修改库存调拨
export function updateTransfer(data) {
  return request({
    url: '/transfer/transfer',
    method: 'put',
    data: data
  })
}

// 修改库存调拨
export function updateAllocate(data) {
  return request({
    url: '/transfer/transfer/status',
    method: 'put',
    data: data
  })
}
// 删除客户信息
export function delTransfer(inventoryTransferId) {
  return request({
    url: '/transfer/transfer/' + inventoryTransferId,
    method: 'delete'
  })
}

// 获取编码
export function getCode(code) {
  return request({
    url: '/transfer/transfer/getcode?code=' + code,
    method: 'post'
  })
}

// 查询详情
export function selectOdInventoryTransfer(inventoryTransferId) {
  return request({
    url: '/transfer/transfer/selectOdInventoryTransfer?inventoryTransferId='+inventoryTransferId,
    method: 'get'
  })
}
